package com.feicheng.house.service.impl;

import com.feicheng.house.entity.Price;
import com.feicheng.house.mapper.PriceMapper;
import com.feicheng.house.result.ResultInfo;
import com.feicheng.house.service.IPriceService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author feichengTech
 * @since 2021-11-20
 */
@Service
public class PriceServiceImpl extends ServiceImpl<PriceMapper, Price> implements IPriceService {

	@Override
	public ResultInfo updatePrice(Price price) {
		
		return ResultInfo.success(this.updateById(price));
	}

	@Override
	public ResultInfo getOnePrice() {
		if (this.list().get(0) == null) {
			Price price = new Price();
			price.setPrice(0);
			this.save(price);
		}
		return ResultInfo.success(this.list().get(0));
	}

}
